package com.example.demo.mapper;


import com.example.demo.model.ChatMessage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface ChatMessageMapper {
    int insert(ChatMessage message);
    
    List<ChatMessage> getMessageList(@Param("userId") Integer userId,
                                     @Param("otherId") Integer otherId);
    
    List<Map<String, Object>> getChatList(Integer userId);
    
    int updateMessageStatus(@Param("receiverId") Integer receiverId, 
                          @Param("senderId") Integer senderId);
    
    int updateLatestProductId(@Param("senderId") Integer senderId,
                            @Param("receiverId") Integer receiverId,
                            @Param("productId") Integer productId);
    
    Integer getLastProductId(@Param("senderId") Integer senderId, 
                            @Param("receiverId") Integer receiverId);

    int getUnreadMessageCount(Integer userId);
} 